package local.blueheart.java8;


import java.util.Arrays;

@FunctionalInterface
interface MyInterface{
    void test();
}

@FunctionalInterface
interface MyInterface1<T>{
    void test(T t);
}

public class TestFunctionInterface {


    void testMyInterface(MyInterface myInterface){
        myInterface.test();
    }

    void testMyInterface1(MyInterface1 myInterface1){
        for (String s : Arrays.asList("1", "2")) {
            myInterface1.test(s);
        }
    }


    public static void main(String[] args){
        TestFunctionInterface testFunctionInterface = new TestFunctionInterface();
        testFunctionInterface.testMyInterface(() -> {
            System.out.println("myInterface");
        });

        testFunctionInterface.testMyInterface1(o -> {
            System.out.println(o);
        });

        MyInterface myInterface = () -> {
            System.out.println("test");
        };
        System.out.println("========interface meta==========");
        System.out.println(myInterface.getClass());
        System.out.println(myInterface.getClass().getSuperclass());
        System.out.println(myInterface.getClass().getInterfaces()[0]);
    }

}
